//
//  PinglunliebiaoViewController.m
//  tianjin
//
//  Created by 鞠超 on 16/8/9.
//  Copyright © 2016年 jc. All rights reserved.
//

#import "PinglunliebiaoViewController.h"

@interface PinglunliebiaoViewController () <UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) UITableView * tableView;

@end

@implementation PinglunliebiaoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self p_navi];
    
    [self p_setupView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - navi
- (void)p_navi
{
    _btnLeft.hidden = YES;
    _lblLeft.hidden = YES;
    _btnRight.hidden = YES;
    _lblRight.hidden = YES;
    _topView.backgroundColor = [UIColor blackColor];
    
    _lblTitle.text = @"评价列表(11)";
    _lblTitle.textColor = [UIColor whiteColor];
    _lblTitle.font = [UIFont systemFontOfSize:19];
    
    UIImageView * image_return = [[UIImageView alloc] initWithFrame:CGRectMake(15, 32, 10, 20)];
    image_return.image = [UIImage imageNamed:@"zuofanhui@2x.png"];
    [_topView addSubview:image_return];
    
    UIButton * btn_return = [UIButton buttonWithType:(UIButtonTypeSystem)];
    btn_return.frame = CGRectMake(10, 20, 35, 44);
    [_topView addSubview:btn_return];
    [btn_return addTarget:self action:@selector(btn_returnAction:) forControlEvents:(UIControlEventTouchUpInside)];
}

//左返回
- (void )btn_returnAction:(UIButton *)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}

//显示tabbar
- (void )viewWillAppear:(BOOL)animated
{
    [(AppDelegate *)[[UIApplication sharedApplication] delegate] hiddenTabBar];
}

#pragma mark - 布局
- (void )p_setupView
{
    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
    
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, SCREEN_HEIGHT - 64) style:(UITableViewStylePlain)];
    self.tableView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.tableFooterView = [[UIView alloc] init];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.view addSubview:self.tableView];
}

#pragma mark - tableview代理
- (NSInteger )numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger )tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 11;
}

- (CGFloat )tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    CGFloat length_W = [@"很好的,比较好,可以谁看见的开始就打开手机端快捷斯柯达就数据库的紧身裤角度看很好的,比较好,可以谁看见的开始就打开手机端快捷斯柯达就数据库的紧身裤角度看很好的,比较好,可以谁看见的开始就打开手机端快捷斯柯达就数据库的紧身裤角度看" boundingRectWithSize:CGSizeMake(SCREEN_WIDTH - 20, 10000)    options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:14]} context:nil].size.height;
    
    return 70 + length_W;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell * cell = [[UITableViewCell alloc] init];
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;

    UIImageView * image_touxiang = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 40, 40)];
    image_touxiang.image = [UIImage imageNamed:@"chanpingPic@2x.png"];
    image_touxiang.layer.cornerRadius = 20;
    image_touxiang.layer.masksToBounds = YES;
    [cell addSubview:image_touxiang];
    
    UILabel * name_user = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(image_touxiang.frame) + 10, 12, SCREEN_WIDTH - CGRectGetMaxX(image_touxiang.frame) - 20, 15)];
    name_user.text = @"用户昵称";
    name_user.font = [UIFont systemFontOfSize:14];
    [cell addSubview:name_user];
    
    UILabel * time_pinglun = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(image_touxiang.frame) + 10, CGRectGetMaxY(name_user.frame) + 8, SCREEN_WIDTH - CGRectGetMaxX(image_touxiang.frame) - 20, 15)];
    time_pinglun.text = @"2016-8-20";
    time_pinglun.font = [UIFont systemFontOfSize:14];
    time_pinglun.textColor = [UIColor grayColor];
    [cell addSubview:time_pinglun];
    
    CGFloat length_W = [@"很好的,比较好,可以谁看见的开始就打开手机端快捷斯柯达就数据库的紧身裤角度看很好的,比较好,可以谁看见的开始就打开手机端快捷斯柯达就数据库的紧身裤角度看很好的,比较好,可以谁看见的开始就打开手机端快捷斯柯达就数据库的紧身裤角度看" boundingRectWithSize:CGSizeMake(SCREEN_WIDTH - 20, 10000)    options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:14]} context:nil].size.height;
    
    UILabel * pingjia_product = [[UILabel alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(image_touxiang.frame) + 10, SCREEN_WIDTH - 20, length_W)];
    pingjia_product.text = @"很好的,比较好,可以谁看见的开始就打开手机端快捷斯柯达就数据库的紧身裤角度看很好的,比较好,可以谁看见的开始就打开手机端快捷斯柯达就数据库的紧身裤角度看很好的,比较好,可以谁看见的开始就打开手机端快捷斯柯达就数据库的紧身裤角度看";
    pingjia_product.numberOfLines = 0;
    pingjia_product.font = [UIFont systemFontOfSize:14];
    [cell addSubview:pingjia_product];
    
    UIView * view_line = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(pingjia_product.frame) + 9, SCREEN_WIDTH, 1)];
    view_line.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [cell addSubview:view_line];
    
    return cell;
}






@end
